<template>
	<view class="mine">
		<scroll-view scroll-y="true" class="scrollView">
			<uni-forms ref="masterEnterForm" :modelValue="FormData" :rules="rules" label-position="top"
				label-width="500rpx">
				<uni-forms-item label="部门名称" name="deptName">
					<input type="text" placeholder="请输入" placeholder-class="placeholder-class"
						v-model="FormData.deptName" />
					<view class="line"></view>
				</uni-forms-item>
				<uni-forms-item label="姓名" name="userName">
					<input type="text" placeholder="请输入" placeholder-class="placeholder-class"
						v-model="FormData.userName" />
					<view class="line"></view>
				</uni-forms-item>
				<uni-forms-item label="年龄" name="age">
					<input type="text" placeholder="请输入" placeholder-class="placeholder-class" v-model="FormData.age" />
					<view class="line"></view>
				</uni-forms-item>
				<uni-forms-item label="手机号" name="phone">
					<input type="text" placeholder="请输入" placeholder-class="placeholder-class"
						v-model="FormData.phone" />
					<view class="line"></view>
				</uni-forms-item>
				<uni-forms-item label="职位" name="job">
					<input type="text" placeholder="请输入" placeholder-class="placeholder-class" v-model="FormData.job" />
					<view class="line"></view>
				</uni-forms-item>
			</uni-forms>
		</scroll-view>

		<you-bottom-btn :btnConfig="bottomBtnConfig" @formSubmit="formSubmit">
		</you-bottom-btn>
	</view>
	</view>
</template>

<script>
	import {
		uploadFilePromise
	} from "@/utils/index.js"
	import Mine from "@/api/mine.js"
	export default {
		data() {
			return {
				bottomBtnConfig: [{
					text: '	保存',
					class: 'confirm',
					funcName: 'formSubmit'
				}],
				FormData: {
					deptName: "",
					userName: "",
					age: '',
					phone: '',
					job: '',
				},
				rules: {
					userName: {
						rules: [{
							required: true,
							errorMessage: '请输入姓名',
						}]
					},
				},
				entInfo: {}
			}
		},
		onLoad(e) {
			console.log(e, 'this.entInfo');
			this.entInfo = e
		},
		methods: {
			formSubmit() {
				this.$refs.masterEnterForm.validate().then(res => {
					Mine.architecture({
						...this.FormData,
						...this.entInfo
					}).then(res => {
						if (res.code == 200) {
							uni.showToast({
								title: '信息添加成功'
							})
							setTimeout(() => {
								uni.navigateBack()
							}, 1000)
						}
					})
				}).catch(err => {})
			}
		}
	}
</script>

<style lang="scss" scoped>
	/deep/.placeholder-class {
		font-size: 32rpx;
		color: $main-font-auxiliary;
		line-height: 1;
	}

	.mine {
		background: #F6F8FA;
		width: 100vw;
		height: 100vh;
		box-sizing: border-box;
		padding: 0 28rpx;
		background: #fff;
	}

	.scrollView {
		height: 100vh;
		box-sizing: border-box;
		padding-bottom: var(env(safe-area-inset-bottom) + 64px);

		.upload-after {
			background: #F6F8FA;
			width: 198rpx;
			height: 198rpx;
			line-height: 1;
			display: flex;
			justify-content: center;
			align-items: center;
		}

		.line {
			opacity: 0.1;
			height: 2rpx;
			background: #000;
			margin-top: 20rpx;
		}
	}
</style>